#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <limits>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

typedef long long int64;
typedef unsigned long long qword;

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef vector<pii> vpii;

typedef pair<int64,int64> pii64;
typedef vector<int64> vi64;
typedef vector<vi64> vii64;
typedef vector<vii64> viii64;
typedef vector<pii64> vpii64;

typedef vector<string> vs;

const int dx[]={0,-1,0,1,-1,1, 1,-1};
const int dy[]={1,0,-1,0, 1,1,-1,-1};
const double eps=1e-8;

#define fori(i,a,b) for(int i(a),_b(b);i<=_b;++i)
#define ford(i,a,b) for(int i(a),_b(b);i>=_b;--i)
#define forn(i,n) fori(i,0,n-1)
#define fora(i,a) fori(i,0,a.size()-1)
#define fore(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define maximum(a) (*max_element(all(a)))
#define minimum(a) (*min_element(all(a)))
#define findx(a,x) (find(all(a),x)-a.begin())
#define two(X) (1LL<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define sqr(a) (a)*(a)
#define nmax 1010
#define mmax 200100
#define kmax 11
#define modulo 1000000007
#define maxc 999999999



class MarbleDecoration {
public:
	int maxLength(int R, int G, int B) {
		if (G>R)
			swap(R,G);
		if (B>R)
			swap(B,R);
		if (B>G)
			swap(B,G);
		return G + min(R, G+1);
	}
};


// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit-pf 2.3.0
#include <iostream>
#include <string>
#include <vector>
#include <ctime>
#include <cmath>
using namespace std;
bool KawigiEdit_RunTest(int testNum, int p0, int p1, int p2, bool hasAnswer, int p3) {
	cout << "Test " << testNum << ": [" << p0 << "," << p1 << "," << p2;
	cout << "]" << endl;
	MarbleDecoration *obj;
	int answer;
	obj = new MarbleDecoration();
	clock_t startTime = clock();
	answer = obj->maxLength(p0, p1, p2);
	clock_t endTime = clock();
	delete obj;
	bool res;
	res = true;
	cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
	if (hasAnswer) {
		cout << "Desired answer:" << endl;
		cout << "\t" << p3 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p3;
	}
	if (!res) {
		cout << "DOESN'T MATCH!!!!" << endl;
	} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
		cout << "FAIL the timeout" << endl;
		res = false;
	} else if (hasAnswer) {
		cout << "Match :-)" << endl;
	} else {
		cout << "OK, but is it right?" << endl;
	}
	cout << "" << endl;
	return res;
}
int main() {
	bool all_right;
	bool disabled;
	bool tests_disabled;
	all_right = true;
	tests_disabled = false;
	
	int p0;
	int p1;
	int p2;
	int p3;
	
	{
	// ----- test 0 -----
	disabled = false;
	p0 = 0;
	p1 = 0;
	p2 = 0;
	p3 = 0;
	all_right = (disabled || KawigiEdit_RunTest(0, p0, p1, p2, true, p3) ) && all_right;
	tests_disabled = tests_disabled || disabled;
	// ------------------
	}
	
	{
	// ----- test 1 -----
	disabled = false;
	p0 = 3;
	p1 = 0;
	p2 = 0;
	p3 = 1;
	all_right = (disabled || KawigiEdit_RunTest(1, p0, p1, p2, true, p3) ) && all_right;
	tests_disabled = tests_disabled || disabled;
	// ------------------
	}
	
	{
	// ----- test 2 -----
	disabled = false;
	p0 = 5;
	p1 = 1;
	p2 = 2;
	p3 = 5;
	all_right = (disabled || KawigiEdit_RunTest(2, p0, p1, p2, true, p3) ) && all_right;
	tests_disabled = tests_disabled || disabled;
	// ------------------
	}
	
	{
	// ----- test 3 -----
	disabled = false;
	p0 = 7;
	p1 = 7;
	p2 = 4;
	p3 = 14;
	all_right = (disabled || KawigiEdit_RunTest(3, p0, p1, p2, true, p3) ) && all_right;
	tests_disabled = tests_disabled || disabled;
	// ------------------
	}
	
	{
	// ----- test 4 -----
	disabled = false;
	p0 = 2;
	p1 = 3;
	p2 = 5;
	p3 = 7;
	all_right = (disabled || KawigiEdit_RunTest(4, p0, p1, p2, true, p3) ) && all_right;
	tests_disabled = tests_disabled || disabled;
	// ------------------
	}
	
	{
	// ----- test 5 -----
	disabled = false;
	p0 = 13;
	p1 = 13;
	p2 = 13;
	p3 = 26;
	all_right = (disabled || KawigiEdit_RunTest(5, p0, p1, p2, true, p3) ) && all_right;
	tests_disabled = tests_disabled || disabled;
	// ------------------
	}
	
	if (all_right) {
		if (tests_disabled) {
			cout << "You're a stud (but some test cases were disabled)!" << endl;
		} else {
			cout << "You're a stud (at least on given cases)!" << endl;
		}
	} else {
		cout << "Some of the test cases had errors." << endl;
	}
	return 0;
}
// PROBLEM STATEMENT
// Ash is a marble collector and he likes to create various ornaments using his marbles.
// 
// One day, Elsh asks him to create a simple decoration for her desk. She wants a sequence of marbles consisting of at most two different colors. To make the sequence look interesting, each pair of adjacent marbles must have different colors.
// 
// Currently, Ash has R red marbles, G green marbles, and B blue marbles. Elsh wants that the resulting sequence is as long as possible. Return this maximum length.
// 
// DEFINITION
// Class:MarbleDecoration
// Method:maxLength
// Parameters:int, int, int
// Returns:int
// Method signature:int maxLength(int R, int G, int B)
// 
// 
// CONSTRAINTS
// -R will be between 0 and 50, inclusive.
// -G will be between 0 and 50, inclusive.
// -B will be between 0 and 50, inclusive.
// 
// 
// EXAMPLES
// 
// 0)
// 0
// 0
// 0
// 
// Returns: 0
// 
// Ash currently doesn't have any marbles at all.
// 
// 1)
// 3
// 0
// 0
// 
// Returns: 1
// 
// The only valid sequence is (red).
// 
// 2)
// 5
// 1
// 2
// 
// Returns: 5
// 
// One possible sequence is (red, blue, red, blue, red).
// 
// 3)
// 7
// 7
// 4
// 
// Returns: 14
// 
// 
// 
// 4)
// 2
// 3
// 5
// 
// Returns: 7
// 
// 
// 
// 5)
// 13
// 13
// 13
// 
// Returns: 26
// 
// 
// 
// END KAWIGIEDIT TESTING
//Powered by KawigiEdit-pf 2.3.0!
